/**
 * @Author: 陈瑞鹏
 * @Date:   2022-11-25 15:30:49
 * @Last Modified by:   陈瑞鹏
 * @Last Modified time: 2022-11-25 15:38:12
 */
const { ccclass, property } = cc._decorator;
@ccclass
export default class mouseCom extends cc.Component {

  @property({ type: cc.Animation, tooltip: "动画" })
  ani: cc.Animation = null;

  @property({ type: cc.Sprite, tooltip: "图片" })
  sp: cc.Sprite = null;

  /**
   * 切换图片
   * @param url 
   */
  drawSp(url) {
    cc.resources.load(url, cc.SpriteFrame, (err, sp: cc.SpriteFrame) => {
      this.sp.spriteFrame = sp;
    })
  }

  /**
   * 切换动画
   * @param aniName 
   */
  playAni(aniName) {
    this.ani.play(aniName);
  }
}